<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>参与投票</title>
    <style type="text/css">
    body{text-align: center;}
html,body{ width:90%; height:90%;text-align: center;margin-left:auto;margin-right:auto;}
div#header {background-color:#99bbbb;}
    #content{text-align: right;}
    </style>
    <script type="text/javascript" src="http://pic.xoyo.com/js/jquery-1.6.min.js"></script>
    <script type="text/javascript">
    function vote(id){
        $.ajax({
            url : 'voteinfo.php',
            data : {'id':id},
            type : "post",
            dataType : "json",
            success : function (result){
                if(result.code){
                    alert(result.msg);
                }else{
                    alert(result.msg);return false;
                }
            },
            error : function (){
                alert('数据加载错误...');
                return false;
            }
        });
    }

    </script>
</head>
<body>
    <div id="header">
        <h1>Main Title of Web Page</h1>
    </div>
    <div id='content'><a href="upload.php?voteId=<?php echo $id;?>">参与PK</a></div>
    <?php if(!empty($result)){?>
    <?php foreach ($result as $key => $value) { ?>
        <div>
            <a href=""><img src='<?php echo $value['img_url'];?>' width='180px' height='110px'></a>
            <input type='button' onclick='vote(<?php echo $value['id'];?>)' value='投票'>
        </div>
    <?php }?>
    <?php }else{?>
    
    <?php }?>
</body>
</html>